<script>
    var pnum = {$pnum};
    {if condition="(isset($filter)) AND ($filter)"}
    var filter = {$filter};
    {/if}
    {if condition="(!isset($search)) OR (!$search)"}
    var search = 0;
    var goUrl = "/{$Request.module}/seckill/lst/filter/"+filter+".html?page="+pnum;
    {else/}
    var search = {$search};
    var goUrl = "/{$Request.module}/seckill/search.html?page="+pnum;
    {/if}

    var sortUrl = "{:url('seckill/order')}";
    $(function(){
        $("#checkAll").click(function () {
            $("input[class='text_id']:checkbox").prop("checked", this.checked);
        });
    });
</script>


<table class="table table-hover table-bordered">
    <thead>
    <tr>
        <th style="width:3%"><input type="checkbox" id="checkAll"/></th>
        <th style="width:5%">ID</th>
        <th style="width:10%">活动名称</th>
        <th style="width:12%">活动时间</th>
        <th style="width:20%">商品信息</th>
        <th style="width:5%">已售</th>
        <th style="width:5%">推荐</th>
        <th style="width:5%">结束时间</th>
        <th style="width:5%">活动状态</th>
        <th style="width:5%">排序</th>
        <th style="width:16%">操作</th>
    </tr>
    </thead>
    <tbody>
    {if condition="!empty($list)"}
    {foreach name="list" item="v"}
    <tr>
        <td><input type="checkbox" class="text_id" name="id[]" value="{$v.id}" /></td>
        <td>{$v.id}</td>
        <td>{$v.activity_name}</td>
        <td>起：{:date('Y-m-d H:i:s',$v['start_time'])}<br>止：{:date('Y-m-d H:i:s',$v['end_time'])}</td>
        <td>{$v.goods_name}</td>
        <td>{$v.sold}</td>
        <td>
            {switch name="$v.recommend"}
            {case value="1"}
            <button class="btn btn-primary btn-xs" type="button" onclick="changeTableVal({$v.id},'recommend',this);"><i class="fa fa-check"></i></button>
            {/case}
            {case value="0"}
            <button class="btn btn-danger btn-xs" type="button" onclick="changeTableVal({$v.id},'recommend',this);"><i class="fa fa-times"></i></button>
            {/case}
            {/switch}
        </td>
        <td align="center">
            {if condition="empty($v['finish_time'])"}
            -
            {else}
            {$v['finish_time']|date="Y-m-d H:i:s",###}
            {/if}
        </td>
        <td>
            {if condition="$v['zhuangtai'] eq 1"}
            <span style="color:#1c84c6;">即将开始</span>
            {elseif condition="$v['zhuangtai'] eq 2"/}
            <span style="color:#1c84c6;">抢购中</span>
            {elseif condition="$v['zhuangtai'] eq 3"/}
            <span style="color:#ed5565;">自动结束</span>
            {elseif condition="$v['zhuangtai'] eq 4"/}
            <span style="color:#ed5565;">手动结束</span>
            {elseif condition="$v['zhuangtai'] eq 5"/}
            <span style="color:#ed5565;">待审核</span>
            {elseif condition="$v['zhuangtai'] eq 6"/}
            <span style="color:#ed5565;">审核未通过</span>
            {/if}
        </td>
        <td><input name="{$v.id}" typed="text" value="{$v.sort}" class="sort" size="1" /></td>
        <td>
            <button type="button" class="btn btn-info btn-xs" onclick="rush_info({$v.id},this);"><i class="fa fa-paste"></i>&nbsp;详细</button>&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-danger btn-xs"  {if condition="$v['finish_status'] neq 0"} disabled {/if} onclick="finishStatus({$v.id});"><i class="fa fa-close"></i>&nbsp;手动结束</button>
            <button type="button" class="btn btn-danger btn-xs" onclick="delone({$v.id},this);"><i class="fa fa-close"></i>&nbsp;删除</button>
        </td>
    </tr>
    {/foreach}
    {else/}
    <tr><td colspan="9" style="text-align:center; font-size:14px;">没有找到相关数据</td></tr>
    {/if}
    </tbody>
</table>
<div class="row"><div class="pagination" style="float:right; margin-right:20px;">{$page}</div></div>